import QtQuick 2.0

Rectangle {
    id:boder
    x:0
    y:0
    width: main.width
    height: 30
    color: "white"

    MouseArea
    {
        anchors.fill: parent
        onPressed:
        {
            main.dragX = mouseX
            main.dragY = mouseY
            main.dragging = true
        }
        onReleased: main.dragging = false
        onPositionChanged:
        {
            if(main.dragging)
            {
                main.x += mouseX - main.dragX
                main.y += mouseY - main.dragY
            }
        }
    }

    //关闭窗口按钮
    Image {
        id: closeButton
        x:0
        anchors.right: parent.right
        width: parent.height
        height: width
        source: "icons/close.png"

        MouseArea{
            anchors.fill: parent
            onClicked: {
                Qt.quit()               //退出程序
            }
        }
    }


    //最小化窗口按钮
    Image {
        id: minButton
        x: 0
        anchors.right: closeButton.left
        anchors.rightMargin: 1
        width: parent.height
        height: width
        source: "icons/min.png"

        MouseArea{
            anchors.fill: parent
            onClicked: {
                main.showMinimized()        //窗口最小化
            }
        }
    }

}
